package projeto1;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;

import java.awt.Font;

import javax.swing.JTextField;
import javax.swing.JButton;

import com.mysql.jdbc.Statement;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.io.PrintStream;
import java.sql.Connection;
import java.sql.ResultSet;



public class CadastroLogradouro extends JFrame {

	private JPanel contentPane;
	private JTextField jtfLogradouro;
	InserirNovoLogin CliControl = new InserirNovoLogin();
	
	private static ResultSet resultet;
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					CadastroLogradouro frame = new CadastroLogradouro();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public CadastroLogradouro() {
		setTitle("TRANSF\u00C1CIL - Cadastrar/Remover Logradouro");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 625, 363);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblNewLabel = new JLabel("Cadastrar / Remover Logradouros no Sistema");
		lblNewLabel.setFont(new Font("Arial", Font.BOLD, 20));
		lblNewLabel.setBounds(10, 11, 456, 31);
		contentPane.add(lblNewLabel);
		
		jtfLogradouro = new JTextField();
		jtfLogradouro.setBounds(166, 123, 390, 20);
		contentPane.add(jtfLogradouro);
		jtfLogradouro.setColumns(10);
		
		JLabel lblNewLabel_1 = new JLabel("ADC(+)LOGRADOURO:");
		lblNewLabel_1.setFont(new Font("Arial", Font.PLAIN, 11));
		lblNewLabel_1.setBounds(35, 126, 147, 14);
		contentPane.add(lblNewLabel_1);
		
		JButton btnNewButton = new JButton("CONFIRMA");
		btnNewButton.setToolTipText("Inserir Dados no Banco de dados");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				String logradouro = jtfLogradouro.getText();
				jtfLogradouro.setText("");
				
				
				CliControl.InsereDados3(logradouro);
				
				
			}
		});
		btnNewButton.setFont(new Font("Arial", Font.PLAIN, 11));
		btnNewButton.setBounds(462, 158, 89, 23);
		contentPane.add(btnNewButton);
		
		JButton btnRemover = new JButton("REMOVER");
		btnRemover.setToolTipText("Remover Logrouro do Banco de Dados");
		btnRemover.setFont(new Font("Arial", Font.PLAIN, 11));
		btnRemover.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				String removerlogradouro= JOptionPane.showInputDialog(null,"Digite o logradouro que deseja excluir :  ");
				CliControl.ExcluirLogradouro(removerlogradouro);
				
				
				
				
			}
		});
		btnRemover.setBounds(510, 291, 89, 23);
		contentPane.add(btnRemover);
		
		JButton btnNewButton_1 = new JButton("ANTERIOR");
		btnNewButton_1.setToolTipText("Retornar para Cadastro de informa\u00E7\u00F5es");
		btnNewButton_1.setFont(new Font("Arial", Font.PLAIN, 11));
		btnNewButton_1.setBounds(10, 298, 89, 23);
		
		 btnNewButton_1.addActionListener(new ActionListener() {
			//Chama retorna cadastro
			public void actionPerformed(ActionEvent e) {
				Cadastro cadastro2 = new Cadastro ();
				cadastro2.setVisible(true);
				CadastroLogradouro.this.dispose();
			}
		});
		
		
		contentPane.add(btnNewButton_1);
		
		JLabel lblNewLabel_2 = new JLabel("Remover logradouro");
		lblNewLabel_2.setFont(new Font("Arial", Font.PLAIN, 11));
		lblNewLabel_2.setBounds(497, 266, 159, 14);
		contentPane.add(lblNewLabel_2);
		
		JButton btnNewButton_2 = new JButton("LIMPAR");
		btnNewButton_2.setToolTipText("Limpar campo Logradouro");
		btnNewButton_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				jtfLogradouro.setText("");
				
				
				
				
			}
		});
		btnNewButton_2.setFont(new Font("Arial", Font.PLAIN, 11));
		btnNewButton_2.setBounds(166, 158, 89, 23);
		contentPane.add(btnNewButton_2);
	}

}

